package cz.muni.fi.pa165.pokemon.dao;

import cz.muni.fi.pa165.pokemon.entity.Pokemon;
import java.util.List;

/**
 * Data Access Object interface for Pokemon entity. 
 * It prescribes CRUD methods as well as couple methods for finding specific
 * entities.
 *
 * @author Dusan Svancara
 */
public interface PokemonDAO {
    
    /**
     * Persists Pokemon entity and sets generated ID to the entity. Its ID 
     * must be null before.
     * 
     * @param pokemon Pokemon entity to be persisted
     * @throws IllegalArgumentException if pokemon is null or 
     *              if pokemon has non-null ID
     */
    void create(Pokemon pokemon);
    
    /**
     * Gets extra service by its ID.
     * 
     * @param id id of the desired entity
     * @return Desired entity, null if not found
     * @throws IllegalArgumentException if id is null
     */
    Pokemon get(Long id);
    
    /**
     * Updates extra service. Its ID must be non-null.
     * 
     * @param pokemon Extra service to be updated
     * @throws IllegalArgumentException if pokemon is null or its id 
     *              is null                  
     */
    void update(Pokemon pokemon);
    
    /**
     * Removes extra service.
     * 
     * @param pokemon Extra service to be removed
     * @throws IllegalArgumentException if pokemon is null
     */
    void remove(Pokemon pokemon);
    
    /**
     * Finds all extra services.
     * 
     * @return List of all extra services
     */
    List<Pokemon> findAll();
    
    /**
     * Finds all extra services with matching name.
     * 
     * @param name name
     * @return List of extra services with matching name.
     * @throws IllegalArgumentException if name is null.
     */
    List<Pokemon> findByName(String name);
}
